<!DOCTYPE html>
<html lang="en">
<head>
    <title>APP打包</title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="Cache-Control" content="no-store, must-revalidate">
    <meta http-equiv="expires" content="Wed, 26 Feb 1997 08:21:57 GMT">
    <meta http-equiv="expires" content="-1">
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"
          name="viewport">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="shortcut icon" href="/dist/img/icon.png" type="image/x-icon">
    <!--字体-->
    <link rel="stylesheet" href="/dist/css/font-awesome.min.css">
    <script src="https://file.ggxqce.com/web/vue.min.js"></script>
</head>
<style>
    [v-cloak] {
        display: none;
    }

    * {
        -webkit-box-sizing: border-box;
        -moz-box-sizing: border-box;
        box-sizing: border-box;
        font-size: 12px;
    }

    body {
        margin: 1px;
        background: #fff;
    }

    .boxBoy {
        background: #fff;
    }

    table {
        border-spacing: 0;
        border-collapse: collapse;
        display: table;
    }

    .weather {
        text-align: center;
        font-size: 16px;
        position: absolute;
        top: 5px;
        line-height: 30px;
        float: left;
    }

    th {
        font-weight: normal;
    }

    table.text-center, table.text-center td, table.text-center th {
        text-align: center;
        font-size: 12px;
    }

    .table-bordered > thead > tr > th, .table-bordered > tbody > tr > th, .table-bordered > tfoot > tr > th, .table-bordered > thead > tr > td, .table-bordered > tbody > tr > td, .table-bordered > tfoot > tr > td {
        border: 1px solid #cbcbcd;
        height: 28px;
        position: relative;
        padding: 0 4px;
    }

    table th {
        background: #f8f8f8;
    }

    .table-bordered {
        border: 1px solid #cbcbcd;
    }

    .table {
        width: 100%;
        max-width: 100%;
    }

    .hidden {
        display: none;
    }

    .lineOne, .lineTwo {
        text-align: left;
    }

    .tdColor {
        background-color: #f8f8f8;
        font-weight: normal;
        color: #333 !important;
    }

    .lineOne span {
        max-height: 24px;
        line-height: 24px;
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 1;
        text-align: left;
    }

    .lineTwo span {
        max-height: 55px;
        line-height: 16px;
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 3;
        text-align: left;
        padding: 5px;

    }

    .div-td-content-more {
        position: absolute;
        height: auto;
        z-index: 999;
        line-height: 20px;
        background-color: #d3e8fd;
        padding: 8px 6px;
        border: 1px solid #e8e8ea;
        display: none;
    }

    .div-td-content-more i {
        width: 15px;
        height: 12px;
        background: url("/dist/img/more-icon.png");
        position: absolute;
        left: 50px;
        top: -12px;
    }

    .clear {
        clear: both
    }

    .boxItem {
        width: 100%;
        margin-top: -1px;
        padding-bottom: 0;
        background: inherit;
        background-color: rgba(255, 255, 255, 1);
        border: none;
        position: relative;
    }

    .boxItemTitle {
        color: #2c8cec;
        font-size: 16px;
        font-weight: bold;
        margin-bottom: 6px;
        text-align: center;
    }

    .home {
        font-size: 14px;
        font-weight: bold;
        margin-bottom: 10px;
        height: 14px;
        line-height: 14px;
        text-align: center;
    }

    .dian-icon {
        background: url("/dist/img/dian.png") no-repeat;
        background-size: cover;
        width: 14px;
        height: 14px;
        display: inline-block;
    }

    .jiaobiao, .jiaobiaoNew {
        position: relative;
    }

    .jiaobiao i {
        display: block;
        width: 0;
        height: 0;
        border-width: 0px 0 12px 12px;
        border-style: solid;
        border-color: transparent transparent transparent #2a8cec;
        position: absolute;
        top: 0px;
        left: 0px;
    }

    .jiaobiaoNew i {
        display: block;
        width: 12px;
        height: 12px;
        background: url("/dist/img/newLog2.png");
        background-size: 100% 100%;
        position: absolute;
        top: 0px;
        left: 0px;
    }

    .lineImg {
        padding-top: 5px !important;
        padding-bottom: 10px !important;
    }

    .lineImg img {
        height: 45px;
        width: 45px;
        float: left;
        margin: 10px;
        object-fit: cover;
    }

    .newCustomer {
        background: url(/dist/img/new.png) no-repeat;
        background-size: cover;
        width: 20px;
        height: 20px;
        right: 0;
        top: 2px;
        position: absolute;
    }

    .wajueji {
        padding-left: 140px;
        background: url("/dist/img/wajueji.png") no-repeat;
        background-size: 120px 88px;
        height: 88px;
        line-height: 88px;
        color: red;
        font-size: 14px;
        font-weight: bold;
        margin-left: 50px;
    }

    .qipao {
        /*background: url(/dist/img/qipao.png);*/
        background-size: 100% 100%;
        height: 88px;
        /* padding: 0 20px; */
        padding-left: 20px;
        /*padding-right: 20px;*/
        color: red;
        line-height: 88px;
        float: left;
        font-size: 14px;
        font-weight: bold;
    }

    .plan1 {
        background: url("/dist/img/plan1.png") no-repeat center center;
        background-size: 100%;
    }

    .plan2 {
        background: url("/dist/img/plan2.png") no-repeat center center;
        background-size: 100%;
    }

    .plan3 {
        background: url("/dist/img/plan3.png") no-repeat center center;
        background-size: 100%;
    }

    .boxItemTitleNotice {
        color: red;
        font-size: 16px;
        font-weight: bold;
        margin-bottom: 10px;
        text-align: center;
    }

    .boxItemTitleNotice i {
        background: url("/dist/img/jg.png") no-repeat center center;
        height: 16px;
        width: 16px;
        background-size: cover;
        display: inline-block;
        margin-bottom: -3px;
        margin-left: 5px;
    }

    .boxItemTitleNoticeTime {
        color: red;
        font-size: 20px;
        font-weight: bold;
        margin-bottom: 10px;
        text-align: center;
    }

    .boxItemTitleNoticeTime i {
        background: url("/dist/img/jg.png") no-repeat center center;
        height: 16px;
        width: 16px;
        background-size: cover;
        display: inline-block;
        margin-bottom: -3px;
        margin-left: 5px;
    }

    .search-button {
        width: 14px;
        height: 14px;
        background-image: url(/dist/img/glass.jpg);
        border: 0 none;
        cursor: pointer;
        margin-top: 0px;
    }

    input[type=button] {
        outline: none;
    }

    .oaBtn {
        background: url(/dist/img/btn-bj2.png) repeat-y !important;
        background-size: 100% 100% !important;
        color: #fff !important;
    }

    .btn-group-sm > .btn, .btn-sm {
        padding: 2px 10px;
    }

    .btn {
        border-radius: 3px;
        -webkit-box-shadow: none;
        box-shadow: none;
        border: 1px solid transparent;
    }

    .pull-right {
        float: right !important;
    }

    .blue {
        color: #39c;
    }

    .red {
        color: #e03800;
    }

    .weather img {
        height: 30px;
        width: 30px;
        float: left;
    }

    .btn-blue {
        border: none;
        background: #2a8cec;
        color: #fff;
        font-size: 16px;
        height: 48px;
        width: 100%;
        border-radius: 2px;
        outline: none;
        font-weight: bold;
    }

    .btn-blue:active {
        border: none;
        background: #356698;
        opacity: 0.8;
        color: #fff;
        font-size: 16px;
        height: 48px;
        width: 100%;
        border-radius: 2px;
        outline: none;
        font-weight: bold;
    }

    .btn-blue.focus, .btn-blue:focus, .btn-blue:hover {
        color: #fff;
        text-decoration: none;

    }

    .line {
        border-bottom: 4px solid #2a8cec;
    }

    .templateStyle {
        margin-top: 15px;
        margin-left: 10px;
        margin-right: 10px;
        box-shadow: 2px 2px 3px #DDDDDD;
    }

    .tdInput {
        color: #2a8cec;
        border: none;
        outline: none;
        width: 100%;
        padding-left: 4px;
    }

    .wyui-autocomplete-panel {
        width: 150px;
        /*height:201px;*/
        max-height: none !important;
        background: #fff;
        border: 1px solid #a0a0a0;
        border-radius: 3px;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
        position: absolute;
        margin: 0px;
        padding: 0px;
        display: none;
        z-index: 9999;
        overflow: auto;
        overflow-x: hidden;
    }

    .wyui-autocomplete-panel ul {
        margin: 0px;
        list-style: none;
        text-align: left;
        width: 100%;
        padding: 2px 0;
    }

    .wyui-autocomplete-panel li {
        list-style: none;
        text-align: left;
        padding-left: 2px;
        cursor: pointer;
        line-height: 24px;
    }

    .wyui-autocomplete-panel li.hover {
        background-color: #e6f2fa;
    }

    .wyui-autocomplete-panel li a {
        color: Black;
        text-decoration: none;
        text-align: left !important;
        height: 20px;
        line-height: 20px;
    }

    .wyui-autocomplete-panel li a:hover {
        text-decoration: none;
        color: Black;
    }

    .userbox {
        background-color: White;
    }

    .userbox .select.user {
        color: #000;
        background-color: #9bcaef;
    }

    .userbox .user {
        height: 20px;
        line-height: 20px;
        max-height: 20px;
        float: left;
        text-align: left;
        min-width: 32px;
        padding-left: 1px;
        overflow: hidden;
        cursor: pointer;
    }

    .userbox input {
        width: 280px;
        border: none;
        outline: none;
        -webkit-appearance: none;
    }
</style>
<body>
<section class="content" id="app" v-cloak style="padding: 0;min-height: 100vh">
    <div class="div-td-content-more"><i></i></div>
    <div class="templateStyle" style="margin-top: 10px;">
        <div class="boxItem">
            <div class="boxBoy">
                <table class="table table-bordered text-center table-width">
                    <tbody>
                    <tr>
                        <td style="background-color: #2c8cec;color: white">基本信息</td>
                        <div class="btn" style="z-index:1000;position: fixed;background: firebrick;
    padding: 0 5px;color: #ffffff;right: 20px;top: 14px" @click="deleteIt">删除该版
                        </div>
                    </tr>
                    </tbody>
                </table>
                <table class="table table-bordered text-center table-width">
                    <tbody>
                    <tr>
                        <td class="tdColor" style="width: 25%;">版本号</td>
                        <td>
                            <input type="text" v-model="pack.versionCode" class="tdInput">
                        </td>
                    </tr>
                    <tr>
                        <td class="tdColor">版本名称</td>
                        <td>
                            <input type="text" v-model="pack.versionName" class="tdInput">
                        </td>
                    </tr>
                    <tr>
                        <td class="tdColor">安装包大小<br>(单位:MB)</td>
                        <td>
                            <input type="text" v-model="pack.apkSize" class="tdInput">
                        </td>
                    </tr>
                    <tr>
                        <td class="tdColor">更新描述<br>(以分号;换行)</td>
                        <td>
                            <textarea type="text" v-model="pack.remark" class="tdInput"
                                      style="width: 100%;height: 55px;resize: none;padding-left: 4px;">

                            </textarea>
                        </td>
                    </tr>
                    <tr>
                        <td class="tdColor">强制更新</td>
                        <td>
                            <span style="display: flex;align-items: center;">
                              <input id="self" type="radio"
                                     value="1" v-model="pack.forceFlag">
                              <label for="self">强制</label>
                              <input id="unself" type="radio" value="0" style="margin-left: 50px"
                                     v-model="pack.forceFlag">
                              <label for="unself">非强制</label>
                            </span>
                        </td>
                    </tr>
                    <tr>
                        <td class="tdColor">版本忽略</td>
                        <td>
                            <span style="display: flex;align-items: center;">
                                 <input id="ignore" type="radio" value="1"
                                        v-model="pack.ignoreFlag">
                              <label for="ignore">忽略</label>
                              <input id="unignore" type="radio" style="margin-left: 50px"
                                     value="0" v-model="pack.ignoreFlag">
                              <label for="unignore">不忽略</label>
                            </span>
                        </td>
                    </tr>
                    </tbody>
                </table>
            </div>
            <div class="clear"></div>
        </div>
    </div>
    <div class="templateStyle" style="margin-top: 10px;">
        <div class="boxItem">
            <div class="boxBoy">
                <table class="table table-bordered text-center table-width">
                    <tbody>
                    <tr>
                        <td style="background-color: #2c8cec;color: white">指定更新(逗号隔开)</td>
                    </tr>
                    </tbody>
                </table>
                <table class="table table-bordered text-center table-width">
                    <tbody>
                    <tr>
                        <td class="tdColor" style="width: 25%;">用户</td>
                        <td>
                            <input id="userName" type="text" class="tdInput" v-model="userNameStr">
                        </td>
                    </tr>
                    <tr>
                        <td class="tdColor">职位</td>
                        <td>
                            <input id="roleName" type="text" class="tdInput" v-model="roleNameStr">
                        </td>
                    </tr>
                    <!--<tr>-->
                    <!--<td class="tdColor">部门</td>-->
                    <!--<td>-->
                    <!--<input id="departName" type="text"  class="tdInput" v-model="departNameStr">-->
                    <!--</td>-->
                    <!--</tr>-->
                    <tr>
                        <td class="tdColor">公司</td>
                        <td>
                            <input id="companyName" type="text" class="tdInput"
                                   v-model="companyNameStr">
                        </td>
                    </tr>
                    </tbody>
                </table>
            </div>
            <div class="clear"></div>
        </div>
    </div>
    <div style="margin-top: 10px;text-align: center">
        <button type="button" class="btn btn-blue" style="width:46% ;border-top: 1px solid white"
                @click="save()">修改
        </button>

        <button type="button" class="btn btn-blue" style="width:46% ;border-top: 1px solid white"
                @click="save(pack.id = '')">发布
        </button>
    </div>
</section>
<!--JQ-->
<script src="https://file.ggxqce.com/web/jquery-2.2.3.min.js"></script>
<!--插件JS-->
<script src="/dist/plugins/scroll/myScroll.js"></script>
<!--框架已定义 JS-->
<!--oa自定义  JS-->
<script src="/dist/js/oaApp.js"></script>

<script type="text/javascript" src="/dist/plugins/lhgdialog/lhgdialog.min.js?self=true"></script>
<script>
    $(function () {
        $("body").on("click", ".lineOne,.lineTwo", function (e) {
            if ($(".div-td-content-more").is(":hidden")) {
                var text = $(this).text();
                if (text != "") {
                    text = "<i></i>" + text;
                    $(".div-td-content-more").html(text).css({
                        "width": $(this).outerWidth() + "px",
                        "left": $(this).offset().left,
                        "top": ($(this).offset().top + $(this).outerHeight()) + "px"
                    }).show();
                    e.stopPropagation();
                }
            } else {
                $(".div-td-content-more").hide();
            }
        });
        $("body").on("click", ".div-td-content-more", function (e) {
            e.stopPropagation();
        });
        $("body").on("click", function () {
            $(".div-td-content-more").hide();
        });
    });
</script>
<script>
    $.ajaxSetup({
        global: true,
        type: "POST",
        cache: false,
        dataType: "json",
        contentType: 'application/json;charset=utf-8',
        beforeSend: function () {
        },
        complete: function () {

        },
        error: function (e) {
            alert('error' + e.responseText);
        }
    });
    $.extend($.wyui, {
        postMethod: function (url, data, callback, sync, id) {
            if (!id) {
                id = "#app"
            }
            $.ajax({
                url: server.ip + url,
                async: sync ? false : true,
                data: JSON.stringify(data),
                beforeSend: function () {

                },
                complete: function () {
                    setTimeout(function () {
                    }, 1000);

                },
                success: function (r) {
                    if (!r.e.code) {
                        callback(r.data.sendData);
                    } else {
                        alert(r.e.desc);
                    }
                },
                error: function (e) {
                    alert(url + e.responseText);
                }
            });
        },
    });
</script>
<script type="text/javascript">
    var app = new Vue({
        el: "#app",
        data: {
            userId: getUrlParamObj().userId,

            userIdArr: [],
            userNameArr: [],
            userNameStr: "",

            roleIdArr: [],
            roleNameArr: [],
            roleNameStr: "",

            departIdArr: [],
            departNameArr: [],
            departNameStr: "",

            companyIdArr: [],
            companyNameArr: [],
            companyNameStr: "",

            pack: {
                ignoreFlag: '0',
                userIds: "",
                roleIds: "",
                departIds: "",
                companyIds: "",
                forceFlag: 1,
                apkSize: '',
                createTime: '',
                versionCode: '',
                versionName: '',
                remark: ''
            },
        },
        methods: {
            get_update: function () {
                var that = this;
                var obj = {
                    dialog: 'show'
                }
                prompt(JSON.stringify(obj))
                that.getMethod("/app/update/getVersion.json", null, function (data) {
                    that.pack = data
                    var obj = {
                        dialog: 'hidden'
                    }
                    prompt(JSON.stringify(obj))
                });
            },
            initCompanyComplete: function () {
                var that = this
                $("#companyName").autoComplete({
                    url: server.ip + "/company/getCompanyList.json",
                    render: function (users, panel) {
                        for (var i = 0; i < users.length; i++) {
                            $("<li></li>").data("autoComplete",
                                users[i]).html("<a>" + users[i].name + "</a>")
                                .appendTo(panel);
                        }
                    },
                    selected: function (user) {
                        that.companyIdArr = []
                        that.companyNameArr = []
                        that.companyNameStr = ""

                        that.companyIdArr.push(user.id)
                        that.companyNameArr.push(user.name)
                        that.companyNameStr = that.companyNameArr.join(',')

                        return false;
                    },
                    height: 210,
                    width: 300
                });
            },
            deleteIt: function () {
                var that = this;
                var obj = {
                    dialog: 'show'
                }
                prompt(JSON.stringify(obj))
                $.wyui.postMethod("/app/update/delById.json", {id: that.pack.id}, function (data) {
                    alert('删除成功')
                    that.get_update()
                });
            },
            save: function () {
                var that = this;
                var obj = {
                    dialog: 'show'
                }
                prompt(JSON.stringify(obj))
                that.pack.createTime = ""
                that.pack.userIds = that.userIdArr.join(',')
                that.pack.roleIds = that.roleIdArr.join(',')
                that.pack.departIds = that.departIdArr.join(',')
                that.pack.companyIds = that.companyIdArr.join(',')
                console.log(that.pack)
                $.wyui.postMethod("/app/update/save.json", that.pack, function (data) {
                    console.log(data.records)
                    alert('保存成功')
                    var obj = {
                        dialog: 'hidden'
                    }
                    prompt(JSON.stringify(obj))
                });
            },
            getMethod: function (url, data, callback) {
                $.ajax({
                    url: server.ip + url,
                    type: "GET",
                    data: JSON.stringify(data),
                    success: function (r) {
                        if (!r.e.code) {
                            callback(r.data.sendData);
                        } else {
                            alert(url + "错误信息：" + r.e.desc);
                        }
                    }
                });
            },
            initUserComplete: function () {
                var that = this
                $("#userName").autoComplete({
                    url: server.ip + urlConfig.system.user.getTop10ByNameUser,
                    render: function (users, panel) {
                        for (var i = 0; i < users.length; i++) {
                            $("<li></li>").data("autoComplete",
                                users[i]).html("<a>" + users[i].name + "&nbsp;&nbsp;&nbsp;" +
                                "(" + "&nbsp;" + users[i].companyName + "-" + users[i].departName + "-" + users[i].roleName + "&nbsp;" + ") " + "</a>")
                                .appendTo(panel);
                        }
                    },
                    selected: function (user) {
                        that.userIdArr = []
                        that.userNameStr = ""
                        // var idx = $(this).attr("idx");
                        that.userIdArr.push(user.id)
                        that.userNameArr.push(user.name)
                        that.userNameStr = that.userNameArr.join(',')
                        console.log(that.userNameStr)
                        return false;
                    },
                    height: 210,
                    width: 300
                });
            },
            initDepartComplete: function () {
                var that = this
                $("#departName").autoComplete({
                    url: server.ip + "/depart/getByDepartName.json",
                    render: function (users, panel) {
                        for (var i = 0; i < users.length; i++) {
                            $("<li></li>").data("autoComplete",
                                users[i]).html("<a>" + users[i].name + "</a>")
                                .appendTo(panel);
                        }
                    },
                    selected: function (user) {
                        that.departIdArr = []
                        that.departNameArr = []
                        that.departNameStr = ""

                        that.departIdArr.push(user.id)
                        that.departNameArr.push(user.name)
                        that.departNameStr = that.departNameArr.join(',')

                        return false;
                    },
                    height: 210,
                    width: 300
                });
            },
            initRoleComplete: function () {
                var that = this
                $("#roleName").autoComplete({
                    url: server.ip + "/roleName/getByRoleName.json",
                    render: function (users, panel) {
                        for (var i = 0; i < users.length; i++) {
                            $("<li></li>").data("autoComplete",
                                users[i]).html("<a>" + users[i].name + "</a>")
                                .appendTo(panel);
                        }
                    },
                    selected: function (user) {
                        that.roleIdArr = []
                        that.roleNameArr = []
                        that.roleNameStr = ""

                        that.roleIdArr.push(user.id)
                        that.roleNameArr.push(user.name)
                        that.roleNameStr = that.roleNameArr.join(',')

                        return false;
                    },
                    height: 210,
                    width: 300
                });
            },

        },
        mounted: function () {
            var that = this;
            that.initUserComplete()
            that.initDepartComplete()
            that.initRoleComplete()
            that.initCompanyComplete()
            that.get_update()
        }
    })
</script>
</body>
</html>